package request

import (
	"github.com/parnurzeal/gorequest"
)

func HttpPost(request *gorequest.SuperAgent, url string, parameter string, requestHeader map[string]string,
	requestBody []byte) (string, int, []error) {
	r := request.Post(url)
	//r = r.RedirectPolicy(redirectPolicyFunc)
	for i, v := range requestHeader {
		r = r.Set(i, v)
	}
	r.SendString(parameter)
	r.Send(string(requestBody))
	resp, body, err := r.End()
	if resp == nil {
		return body, 0, err
	}
	return body, resp.StatusCode, err
}
